package co.yixiang.modules.order.cart.render.impl;

import co.yixiang.common.utils.SnowFlake;
import co.yixiang.modules.order.cart.entity.dto.StoreRemarkDTO;
import co.yixiang.modules.order.cart.entity.dto.TradeDTO;
import co.yixiang.modules.order.cart.entity.enums.RenderStepEnums;
import co.yixiang.modules.order.cart.render.CartRenderStep;
import org.springframework.stereotype.Service;

/**
 * sn 生成
 *
 * @author Chopper
 * @since 2020-07-02 14:47
 */
@Service
public class CartSnRender implements CartRenderStep {

    @Override
    public RenderStepEnums step() {
        return RenderStepEnums.CART_SN;
    }

    @Override
    public void render(TradeDTO tradeDTO) {

        //生成各个sn
        tradeDTO.setSn(SnowFlake.createStr("T"));
        tradeDTO.getCartList().forEach(item -> {
            //写入备注
            item.setSn(SnowFlake.createStr("O"));
        });

    }
}
